<?php
/**
 * @author chenshubo
 * 查询渠道账户详情
 */
namespace App\Service\OrderService\OrderInterfaceService;

use App\Service\BaseService;
use App\Service\Code\Normal;
use App\Model\PssModel\Business;

class QueryAccount extends BaseService{

    /**
     * 查询渠道账户详情
     */
    public function index( $param = [] ) {
        if( empty($param['requestData']['channel_id'])) {
            return Normal::returnCode(Normal::FAIL,"except param requestData.channel_id");
        }

        $channel_id = checkFields($param['requestData']['channel_id']);
        if ( $channel_id != $param['requestData']['channel_id'] ) {
            return Normal::returnCode(Normal::FAIL,"except param requestData.channel_id 不能包含特殊字符");
        }

        $row = Business::instance()->info(['channel_id' => $channel_id], ['total_balance_settlement_money as balance','settlement','settlement_warn_money']);
        
        if( empty($row) ) {
            return Normal::returnCode(Normal::FAIL,"当前渠道信息不存在");
        }

        return Normal::returnCode(Normal::SUC,"获取成功",[
            'info' => $row
        ]);
    }
}